﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTO;
using DAO;
using BUS;

namespace BUS
{
    public class LoaiSanPhamBus
    {
        public static bool ThemLoaiSanPham(LoaiSanPhamDto one)
        {
            bool result = false;
            if (LoaiSanPhamDao.KiemtraTontai(one) == false)
                result = LoaiSanPhamDao.ThemLoaiSanPham(one);

            return result;
        }

        public static bool XoaLoaiSanPham(LoaiSanPhamDto one)
        {
            bool result = false;
            if (LoaiSanPhamDao.KiemtraTontai(one) == true)
                result = LoaiSanPhamDao.XoaLoaiSanPham(one);

            return result;
        }

        public static bool CapnhatLoaiSanPham(LoaiSanPhamDto one)
        {
            bool result = false;
            if (LoaiSanPhamDao.KiemtraTontai(one) == true)
                result = LoaiSanPhamDao.CapnhatLoaiSanPham(one);

            return result;
        }

        public static List<LoaiSanPhamDto> LayDanhSachLoaiSanPham()
        {
            return LoaiSanPhamDao.LayDanhSachLoaiSanPham();
        }
        public static bool KiemTraLoaiSanPhamTheoTen(string ten)
        {
            return LoaiSanPhamDao.KiemTraLoaiSanPhamTheoTen(ten);
        }
        public static List<LoaiSanPhamDto> LayLoaiSanPhamTheoKey(String key)
        {
            return LoaiSanPhamDao.LayLoaiSanPhamTheoKey(key);
        }
        public static LoaiSanPhamDto LayLoaiSanPhamTheoID(int ID)
        {
            return LoaiSanPhamDao.LayLoaiSanPhamTheoID(ID);    
        }

    }
}
